package com.xiyi.shouxin.entity.admin.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.lang.Nullable;

import com.xiyi.shouxin.entity.admin.Menu;

public class MenuMapper implements RowMapper<Menu> {
    @Override
    @Nullable
    public Menu mapRow(@Nullable ResultSet rs, int rowNum) throws SQLException {
        Menu menu = new Menu();
        if (rs == null) {
            return menu;
        }
        menu.setId(rs.getLong("id"));
        menu.setName(rs.getString("name"));
        menu.setPath(rs.getString("path"));
        menu.setTitle(rs.getString("title"));
        menu.setRequiresAuth(rs.getInt("requires_auth"));
        menu.setOrder(rs.getInt("order"));
        menu.setIcon(rs.getString("icon"));
        menu.setPinTab(rs.getInt("pin_tab"));
        menu.setMenuType(rs.getString("menu_type"));
        menu.setComponentPath(rs.getString("component_path"));
        menu.setPid(rs.getLong("pid"));
        return menu;
    }
}
